import { bg_image } from "./indoorConfig.js";
import {merchantWxaCode} from "../api/merchant/index.js"
export default {
	data() {
		return {
			bg_image,
			query:{
				merchantCouponType: null,//商家优惠券类型 1.满减券 2.全免券
				couponMoney: null,
				merchantId: null,
				path: 'https://indoor.ipark.vip/#/pages/couponByPlate/index',
				qrcodeId: ''
			},
			codeImg:'',
		}
	},
	onLoad(options){
		console.log(JSON.parse(options.params))
		this.query=JSON.parse(options.params)
		this.getQrCode()
	},
	methods: {
		async getQrCode(){
			let res = await merchantWxaCode(this.query)
			let data = res.data || {}
			this.codeImg = data.qrcodeBase64
			this.query.qrcodeId=res.data.qrcodeId
		},
		sendUser(){
			uni.navigateTo({
				url:`/pages/indoor/couponByPlate?params=${JSON.stringify(this.query)}&appoint=1`
			})
		}
	}
}